package com.basaji.dao.impl;

import java.util.List;

import com.basaji.dao.IItemDao;
import com.basaji.dao.ITopicDao;
import com.basaji.domain.pojo.Item;
import com.basaji.domain.pojo.Topic;

public class ItemDao extends BaseDao implements IItemDao {

	@SuppressWarnings("unchecked")
	@Override
	public List<Item> getItems(int classId, int start, int size)
			throws Exception {
		return pojoManager.getList("from Item where classification.id= ? or classification.parentId=? order by id desc", new Object[]{classId,classId}, start, size);
	}

	@Override
	public int getItemCount(int classId) throws Exception {
		return pojoManager.getIntCount("select count(id) from Item where classification.id= ? or classification.parentId=? ",new Object[]{classId,classId});
	}
}
